package co.za.gvi.example;

import co.za.gvi.handler.DispatchMessageHandler;
import co.za.gvi.transport.MessageProxy;
import co.za.gvi.transport.Transport;

public class Test {
	// Please, provide the affiliateCode, authenticationCode and url
	private static String affiliateCode = "GEO002";
	private static String authenticationCode = "GEOPEASI";
	private static String url = "http://www.gvi.bms.vine.co.za:8080/httpInputhandler/ApplinkUpload";

	public static void main(String args[]) {
		try {
			// Register the custom object factory
			DispatchMessageHandler.registerObjectFactory(CustomDataFactory.class);
			
			// creates a MessageProxy to build the message
			MessageProxy messageProxy = new MessageProxy ();
			
			// Add message per recipient
			messageProxy.addRecipient("0760625275", "This message is a messag");
			
			// creates a Transport to send the message
			Transport transport = Transport.createTransport(url, affiliateCode, authenticationCode);
			transport.connect();
			transport.send(messageProxy);
			transport.print(messageProxy);
			transport.disconnect();
			
		}catch (Exception e) {
			e.printStackTrace();
		}
	}
}
